/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Report.java
 *
 * Created on May 13, 2012, 2:34:17 PM
 */
package GUI;
import system_interface.*;
import javax.swing.table.*;
/**
 *
 * @author Jeremy
 */
public abstract class Report extends javax.swing.JPanel {
    
    protected SystemInterface si;
    
    /** Creates new form Report */
    public Report(SystemInterface si) {
        initComponents();
        this.si = si;
        this.setBorder(new javax.swing.border.EtchedBorder());
    }

   public Report(SystemInterface si, java.awt.Dimension d) {
        initComponents();
        this.setBorder(new javax.swing.border.EtchedBorder());
        this.ChangeSize(d);
        this.si = si;
    }
    
    public abstract void Update();
    
    public final void ChangeSize(java.awt.Dimension d) {
        this.setPreferredSize(d);
    }
    static void displayTable(DefaultTableModel model, String[] list) {
        int ListLength = list.length;
        if(list[0].equals("")) ListLength = 0;
        int NumRows = model.getRowCount();
        int NumDif = ListLength - NumRows;
        if(NumDif > 0) for(int i = 0; i < NumDif; i++) model.addRow(new String[] {""});
        else if(NumDif <0) for(int i = 0; i < NumDif*-1; i++) model.removeRow(model.getRowCount() - 1);
        for(int i = 0; i < ListLength; i++) model.setValueAt(list[i], i, 0);
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
